home *** CD-ROM | disk | FTP | other *** search
- head 1.3;
- access;
- symbols
- VER_0_3:1.3
- VER_0_2:1.2;
- locks; strict;
- comment @# @;
-
-
- 1.3
- date 95.03.24.11.43.35; author coulter; state Exp;
- branches;
- next 1.2;
-
- 1.2
- date 95.02.19.16.06.41; author coulter; state Exp;
- branches;
- next 1.1;
-
- 1.1
- date 95.02.18.08.36.38; author coulter; state Exp;
- branches;
- next ;
-
-
- desc
- @replace a link with a different link
- @
-
-
- 1.3
- log
- @Checkin version for 0.3 distribution.
- @
- text
- @#! /bin/ksh
- USAGE='USAGE: replace_link FILE_PATH DEST_PATH
- FILE_PATH should be a link whose ultimate desitnation is DEST_PATH.
- Replace FILE_PATH with a link to DEST_PATH.
- '
- # (C) Copyright 1995 by Michael Coulter. All rights reserved.
-
- # Process parameters
- if [ $# -ne 2 ]
- then
- echo "$USAGE" >&2
- echo "Expected 2 arguments, got $#" >&2
- exit 1
- fi
- FILE_PATH="$1"; shift
- DEST_PATH="$1"; shift
- ##echo "replace_link: At 1, DEST_PATH is $DEST_PATH"
- if [ ! -L "$FILE_PATH" ]
- then
- echo "$USAGE" >&2
- echo "FILE_PATH, $FILE_PATH , is not a link." >&2
- exit 1
- fi
- ##echo "replace_link: At 1, DEST_PATH is $DEST_PATH"
- ##echo "replace_link: At 1, FILE_PATH is $FILE_PATH"
- ##echo "replace_link: At 2, DEST_PATH is $DEST_PATH"
- # If DEST_PATH starts with the directory of $FILE, then use a
- # relative link
- FRONT="$(dirname "$FILE_PATH")/"
- eval "DEST_PATH=\"${DEST_PATH#${FRONT}}\""
- ##echo "replace_link: At 3, DEST_PATH is $DEST_PATH"
- echo "replace_link: Replace $FILE_PATH with $DEST_PATH"
- rm "$FILE_PATH"
- ln -s "$DEST_PATH" "$FILE_PATH"
- exit 0
- @
-
-
- 1.2
- log
- @Checkpoint version 0.1
- @
- text
- @d6 1
- @
-
-
- 1.1
- log
- @Checkpoint version before fixing /usr/bin install
- @
- text
- @d16 1
- d23 3
- a25 6
- if [ -L "$DEST_PATH" -o ! -e "$DEST_PATH" ]
- then
- echo "$USAGE" >&2
- echo "DEST_PATH, $DEST_PATH , does not exist or is a link." >&2
- exit 1
- fi
- d30 1
- @
-